<template>
	<div class="mainContent">
		<!-- <div class="fun_area">
			<el-button type="primary" @click="addPlan">添加</el-button>
		</div> -->
		<div class="table_area">
			<el-table :data="tableData" border style="width: 100%">
				<el-table-column align="center" prop="name" label="名称">
				</el-table-column>
				<el-table-column align="center" prop="title" label="标题">
				</el-table-column>

				<el-table-column align="center" prop="image" label="图片 ">
					<template slot-scope="scope">
						<el-image  style="width: 70px; height: 70px"  :src='scope.row.images' size="small" type="primary">修改</el-image>
					</template>
				</el-table-column>

				<el-table-column align="center" fixed="right" label="操作">
					<template slot-scope="scope">
						<el-button @click="editSetting(scope.row)" size="small" type="primary">修改</el-button>
					</template>
				</el-table-column>
			</el-table>
		</div>
		<add ref="add" @refresh="refresh"></add>
	</div>
</template>

<script>
	// recommend
	import {
		zhuanfas,
		zhuanfaupdate
	} from "@/api/forwardSetting";
	import add from "./modules/add";
	export default {
		name: "Dashboard",
		components: {
			add,
		},
		data() {
			return {
				tableData: []
			}
		},
		mounted() {
			this.zhuanfas()
		},
		methods: {
			refresh() {
				this.zhuanfas();
			},
			async zhuanfas() {
				let result = await zhuanfas();
				console.log('xxxxxxxxxxxxx', result);
				if (result.code == 0) {
					this.tableData = result.data;
				}
			},
			addPlan() {
				this.$refs.add.add();
			},
			editSetting(val) {
				this.$refs.add.edit(val);
			},
			async deldel(val) {
				let result = await shuiguotjdel({
					id: parseInt(val.id)
				});
				if (result.code == 0) {
					this.$message({
						showClose: true,
						message: "删除成功",
						type: "success",
					});
					this.zhuanfas()
				}
			},
		}
	}
</script>

<style>
	.fun_area {
		padding: 20px;
		margin-bottom: 20px;
		background-color: #fff;
		border: 1px solid #EBEEF5;
		background-color: #FFF;
		filter: drop-shadow(2px 2px 3px #e5e5e5);
	}
</style>